//------------------------------------------------------------------------------
// <copyright file="EntryAssemblyHelper.cs" company="Damian Antonowicz">
//       copyright © 2010 Damian Antonowicz
// </copyright>
// <author>Damian Antonowicz</author>
// <email>poczta@damianantonowicz.pl</email>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace DotBeer.Business.Entities
{
    public static class EntryAssemblyHelper
    {
        #region properties

        public static string ProductName
        {
            get
            {
                return GetAttribute<AssemblyProductAttribute>().Product;
            }
        }

        public static string CompanyName
        {
            get
            {
                return GetAttribute<AssemblyCompanyAttribute>().Company;
            }
        }

        #endregion

        #region private methods

        private static T GetAttribute<T>() where T : class
        {
            return Assembly.GetEntryAssembly()
                           .GetCustomAttributes(typeof(T), true)
                           .First() as T;
        }

        #endregion
    }
}
